/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package eproject_sem2;

/**
 *
 * @author ZER0
 */
public class RandomID {
    public final static int STR_NUMBER = 1;
    public final static int STR_UPPER_CASE = 2;
    public final static int STR_LOWER_CASE = 4;
    private final static String NUMBERS = "0123456789";
    private final static String ALPHABE = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";

    private String input = new String(" ");
    
    public RandomID(int mode) {
        if(STR_NUMBER != 0) {
            input += NUMBERS;
        }
        if(STR_UPPER_CASE != 0) {
            input += ALPHABE;
        }
        if(STR_LOWER_CASE != 0 || input.isEmpty()) {
            input += ALPHABE.toLowerCase();
        }
    }

    public String next(int length) {
        String string = new String();
        final int max = input.length();
        for(int i=0; i<length; i++) {
            string += input.charAt(((int)(Math.random()*1000)) % max);
        }
        return string.toUpperCase();
    }
}
